//
//  OPBoard_Extensions.h
//  OPFramework
//
//  Created by malcom on 7/20/08.
//  Copyright 2008 malcom-mac software. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "OPBoard.h"
#import "OPPageContainer.h"

@interface OPSmartTopics : OPBaseObject {
	OPPageContainer						*_activeTopics;					// active topics cache
	OPPageContainer						*_unansweredTopics;				// unanswered topics
	OPPageContainer						*_hotTopics;					// hot topics
	OPPageContainer						*_newTopicsSinceRefDate;		// new topics
	OPPageContainer						*_recentAnnouncements;			// nrecent announcements
	OPPageContainer						*_bookmarkedTopics;				// bookmarked topics
	
	// INTERNAL PROPERTIES
	int									_int_whatCachedInNewTopics;
	int									config_daysAgoToSearch;
	NSObject <OPObject_AsyncResponse>	*obj_listener;
}

@property (readonly) OPPageContainer						*_activeTopics;
@property (readonly) OPPageContainer						*_unansweredTopics;
@property (readonly) OPPageContainer						*_hotTopics;
@property (readonly) OPPageContainer						*_newTopicsSinceRefDate;
@property (readonly) OPPageContainer						*_recentAnnouncements;
@property (readonly) OPPageContainer						*_bookmarkedTopics;


#pragma mark INIT
- (id) initWithBoard:(OPBoard *) _board andListener:( NSObject <OPObject_AsyncResponse> *) _listener;

#pragma mark PUBLIC METHODS
- (NSArray *) getActiveTopicsSinceDays:(NSNumber *) _daysAgo atPage:(NSNumber *) _pageIdx;
- (NSArray *) getUnansweredTopicsSinceDays:(NSNumber *) _daysAgo atPage:(NSNumber *) _pageIdx;
- (NSArray *) getHotTopics:(NSNumber *) _maxToList;
- (NSArray *) getNewTopicsSinceLastLoginAtPage:(NSNumber *) _pageIdx;
- (NSArray *) getNewTopicsFromDate:(NSCalendarDate *) _startDate endDate:(NSCalendarDate *) _endDate atPage:(NSNumber *) _pageIdx;
- (NSArray *) getRecentAnnouncements:(NSNumber *) _maxElements;
- (NSArray *) getBookmarkedTopics;

#pragma mark PRIVATE METHODS
- (void) _parseResponseTopicsList:(NSArray *) _result;
- (OPPageContainer *) _getTargetPageForMethod:(NSString *) _meth;
- (void) _setDaysToSearch:(NSNumber *) _days forTable:(OPPageContainer *) _pageTable;
- (NSArray *) _getNewTopicsFromDate:(NSCalendarDate *) _startDate endDate:(NSCalendarDate *) _endDate atPage:(NSNumber *) _pageIdx;

@end
